package caip2022p.rcv3;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        // Read N and T
        int N = scanner.nextInt();
        int T = scanner.nextInt();
        scanner.nextLine(); // Consume the remaining newline
        
        // Process N lines of data
        for (int i = 0; i < N; i++) {
            String line = scanner.nextLine();
            String[] data = line.split("\\s+"); // Split on any whitespace
            int value = Integer.parseInt(data[1]);
            
            // Check if value is outside the target range
            if (value < 80 - T || value > 80 + T) {
                System.out.println(line); // Print original line
            }
        }
        
        scanner.close();
    }
}
